package com.robusta.app.persistence;

import com.robusta.app.domain.user.UserContextHolder;
import com.robusta.app.domain.user.UserFixture;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:persistence-config.xml", "classpath:persistence-config-test.xml"})
@DirtiesContext
public class RepositoryTestBase {
    @Before
    public void setUp() throws Exception {
        UserContextHolder.setCurrentUser(UserFixture.DEFAULT);
    }

    @After
    public void tearDown() throws Exception {
        UserContextHolder.clear();
    }
}
